package com.controller.ydq;

import com.bean.ydq.StuInfo;
import com.config.Result;
import com.service.StuStateService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@RestController
public class StuStateController {
    @Resource
    StuStateService stuStateService;

    /**
     * 获得学生信息状态按照groups分组
     * @param interviewerId
     * @param state
     * @return
     */
    @RequestMapping(value = "/getState",method = RequestMethod.GET)
    public Result getUntreated(@RequestParam(value="interviewid")Integer interviewerId,@RequestParam(value = "state")String state){
        List<StuInfo> stuInfo = stuStateService.getState(interviewerId,state);
        return new Result(stuInfo);
    }

    /**
     * 获得所有学生信息状态按照groups分组
     * @param
     * @return
     */
    @RequestMapping(value = "/getAllStu",method = RequestMethod.GET)
    public Result getAllStu(@RequestParam(value = "state")String state){
        List<StuInfo> stuInfo = stuStateService.getAllStu(state);
        return new Result(stuInfo);
    }

    /**
     * 获得当前面试官所有学生信息状态按照groups分组
     * @param interviewerId
     * @return
     */
    @RequestMapping(value = "/getAll",method = RequestMethod.GET)
    public Result getAll(@RequestParam(value="interviewid")Integer interviewerId){
        List<StuInfo> stuInfo = stuStateService.getAll(interviewerId);
        return new Result(stuInfo);
    }

    /**
     * 修改学生信息
     * @param stuId
     * @param groups
     * @param intJob
     * @return
     */
    @RequestMapping(value = "/updateStu",method = RequestMethod.GET)
    public Result updataStu(@RequestParam(value="stuid")Integer stuId,@RequestParam(value="groups")String groups,@RequestParam(value="intjob")String intJob){
        String upResult = stuStateService.updataStu(stuId,groups,intJob);
        return new Result(upResult);
    }

    /**
     * 获得待面试学生信息
     * @param interviewerId
     * @param state
     * @return
     */
    @RequestMapping(value = "/tobeInterviewed",method = RequestMethod.GET)
    public Result gettobeInterviewed(@RequestParam(value="interviewid")Integer interviewerId,@RequestParam(value = "state")String state){
        List<StuInfo> stuInfo = stuStateService.gettobeInterviewed(interviewerId,state);
        return new Result(stuInfo);
    }

    /**
     * 获得通过学生信息名单
     * @param interviewerId
     * @param state
     * @return
     */
    @RequestMapping(value = "/pass",method = RequestMethod.GET)
    public Result getPass(@RequestParam(value="interviewid")Integer interviewerId,@RequestParam(value = "state")String state){
        List<StuInfo> stuInfo = stuStateService.getPass(interviewerId,state);
        return new Result(stuInfo);
    }


    /**
     * 获得未通过学生信息名单
     * @param interviewerId
     * @param state
     * @return
     */
    @RequestMapping(value = "/failed",method = RequestMethod.GET)
    public Result getFailed(@RequestParam(value="interviewid")Integer interviewerId,@RequestParam(value = "state")String state){
        List<StuInfo> stuInfo = stuStateService.getFailed(interviewerId,state);
        return new Result(stuInfo);
    }






}
